<!-- HTML header for doxygen 1.8.14-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="cache-control" content="max-age=86400"/>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>GBDK 2020 Docs: gbdk-lib/include/gbdk/incbin.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen_extra.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">GBDK 2020 Docs
   &#160;<span id="projectnumber">4.4.0</span>
   </div>
   <div id="projectbrief">API Documentation for GBDK 2020</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('incbin_8h.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#define-members">Macros</a>  </div>
  <div class="headertitle">
<div class="title">incbin.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &lt;<a class="el" href="stdint_8h_source.html">stdint.h</a>&gt;</code><br />
</div>
<p><a href="incbin_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a51ab79f8ee37368158b1887b65ef97ec"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="incbin_8h.html#a51ab79f8ee37368158b1887b65ef97ec">INCBIN_EXTERN</a>(VARNAME)</td></tr>
<tr class="separator:a51ab79f8ee37368158b1887b65ef97ec"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aeacb5370285c0d4308d0fe5f29da8d15"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="incbin_8h.html#aeacb5370285c0d4308d0fe5f29da8d15">INCBIN_SIZE</a>(VARNAME)&#160;&#160;&#160;( (<a class="el" href="stdint_8h.html#adf4d876453337156dde61095e1f20223">uint16_t</a>) &amp; __size_ ## VARNAME )</td></tr>
<tr class="separator:aeacb5370285c0d4308d0fe5f29da8d15"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a42705001e2b9897f5167b67fb36c69dd"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="incbin_8h.html#a42705001e2b9897f5167b67fb36c69dd">BANK</a>(VARNAME)&#160;&#160;&#160;( (<a class="el" href="stdint_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a>) &amp; __bank_ ## VARNAME )</td></tr>
<tr class="separator:a42705001e2b9897f5167b67fb36c69dd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af34047ed60abd6453f819c2a5230cd2b"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="incbin_8h.html#af34047ed60abd6453f819c2a5230cd2b">INCBIN</a>(VARNAME,  FILEPATH)</td></tr>
<tr class="separator:af34047ed60abd6453f819c2a5230cd2b"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Allows binary data from other files to be included into a C source file.</p>
<p>It is implemented using asm .incbin and macros.</p>
<p>See the <code>incbin</code> example project for a demo of how to use it. </p>
</div><h2 class="groupheader">Macro Definition Documentation</h2>
<a id="a51ab79f8ee37368158b1887b65ef97ec"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a51ab79f8ee37368158b1887b65ef97ec">&#9670;&nbsp;</a></span>INCBIN_EXTERN</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define INCBIN_EXTERN</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">VARNAME</td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line"><span class="keyword">extern</span> <span class="keyword">const</span> <a class="code" href="stdint_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> VARNAME[]; \</div>
<div class="line">extern <span class="keyword">const</span> <span class="keywordtype">void</span> __size_ ## VARNAME; \</div>
<div class="line">extern <span class="keyword">const</span> <span class="keywordtype">void</span> __bank_ ## VARNAME;</div>
<div class="ttc" id="astdint_8h_html_aba7bc1797add20fe3efdf37ced1182c5"><div class="ttname"><a href="stdint_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a></div><div class="ttdeci">unsigned char uint8_t</div><div class="ttdef"><b>Definition:</b> stdint.h:51</div></div>
</div><!-- fragment --><p>Creates extern entries for accessing a <a class="el" href="incbin_8h.html#af34047ed60abd6453f819c2a5230cd2b">INCBIN()</a> generated variable and it's size in another source file.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">VARNAME</td><td>Name of the variable used with INCBIN</td></tr>
  </table>
  </dd>
</dl>
<p>An entry is created for the variable and it's size variable.</p>
<p><a class="el" href="incbin_8h.html#af34047ed60abd6453f819c2a5230cd2b">INCBIN()</a>, <a class="el" href="incbin_8h.html#aeacb5370285c0d4308d0fe5f29da8d15">INCBIN_SIZE()</a> </p>

</div>
</div>
<a id="aeacb5370285c0d4308d0fe5f29da8d15"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aeacb5370285c0d4308d0fe5f29da8d15">&#9670;&nbsp;</a></span>INCBIN_SIZE</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define INCBIN_SIZE</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">VARNAME</td><td>)</td>
          <td>&#160;&#160;&#160;( (<a class="el" href="stdint_8h.html#adf4d876453337156dde61095e1f20223">uint16_t</a>) &amp; __size_ ## VARNAME )</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Obtains the <b>size in bytes</b> of the <a class="el" href="incbin_8h.html#af34047ed60abd6453f819c2a5230cd2b">INCBIN()</a> generated data</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">VARNAME</td><td>Name of the variable used with INCBIN</td></tr>
  </table>
  </dd>
</dl>
<p>Requires <a class="el" href="incbin_8h.html#a51ab79f8ee37368158b1887b65ef97ec">INCBIN_EXTERN()</a> to have been called earlier in the source file</p>
<p><a class="el" href="incbin_8h.html#af34047ed60abd6453f819c2a5230cd2b">INCBIN()</a>, <a class="el" href="incbin_8h.html#a51ab79f8ee37368158b1887b65ef97ec">INCBIN_EXTERN()</a> </p>

</div>
</div>
<a id="a42705001e2b9897f5167b67fb36c69dd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a42705001e2b9897f5167b67fb36c69dd">&#9670;&nbsp;</a></span>BANK</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define BANK</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">VARNAME</td><td>)</td>
          <td>&#160;&#160;&#160;( (<a class="el" href="stdint_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a>) &amp; __bank_ ## VARNAME )</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Obtains the <b>bank number</b> of the <a class="el" href="incbin_8h.html#af34047ed60abd6453f819c2a5230cd2b">INCBIN()</a> generated data</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">VARNAME</td><td>Name of the variable used with INCBIN</td></tr>
  </table>
  </dd>
</dl>
<p>Requires <a class="el" href="incbin_8h.html#a51ab79f8ee37368158b1887b65ef97ec">INCBIN_EXTERN()</a> to have been called earlier in the source file</p>
<p><a class="el" href="incbin_8h.html#af34047ed60abd6453f819c2a5230cd2b">INCBIN()</a>, <a class="el" href="incbin_8h.html#a51ab79f8ee37368158b1887b65ef97ec">INCBIN_EXTERN()</a> </p>

</div>
</div>
<a id="af34047ed60abd6453f819c2a5230cd2b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af34047ed60abd6453f819c2a5230cd2b">&#9670;&nbsp;</a></span>INCBIN</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define INCBIN</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">VARNAME, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">FILEPATH&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line"><span class="keywordtype">void</span> __func_ ## VARNAME(<span class="keywordtype">void</span>) __banked __naked { \</div>
<div class="line">__asm \</div>
<div class="line">_ ## VARNAME:: \</div>
<div class="line">1$: \</div>
<div class="line">    .incbin FILEPATH \</div>
<div class="line">2$: \</div>
<div class="line">    ___size_ ## VARNAME = (2$-1$) \</div>
<div class="line">    .globl ___size_ ## VARNAME \</div>
<div class="line">    .local b___func_ ## VARNAME \</div>
<div class="line">    ___bank_ ## VARNAME = b___func_ ## VARNAME \</div>
<div class="line">    .globl ___bank_ ## VARNAME \</div>
<div class="line">__endasm; \</div>
<div class="line">}</div>
</div><!-- fragment --><p>Includes binary data into a C source file</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">VARNAME</td><td>Variable name to use </td></tr>
    <tr><td class="paramname">FILEPATH</td><td>Path to the file which will be binary included into the C source file</td></tr>
  </table>
  </dd>
</dl>
<p><b>filepath</b> is relative to the working directory of the tool that is calling it (often a makefile's working directory), <b>NOT</b> to the file it's being included into.</p>
<p>The variable name is not modified and can be used as-is.</p>
<p>The <a class="el" href="incbin_8h.html#af34047ed60abd6453f819c2a5230cd2b">INCBIN()</a> macro will declare the <a class="el" href="gb_8h.html#a42705001e2b9897f5167b67fb36c69dd">BANK()</a> and <a class="el" href="incbin_8h.html#aeacb5370285c0d4308d0fe5f29da8d15">INCBIN_SIZE()</a> helper symbols. Then if <a class="el" href="incbin_8h.html#a51ab79f8ee37368158b1887b65ef97ec">INCBIN_EXTERN()</a> is used in the header then those helper macros can be used in the application code.</p><ul>
<li><a class="el" href="incbin_8h.html#aeacb5370285c0d4308d0fe5f29da8d15">INCBIN_SIZE()</a> for obtaining the size of the included data.</li>
<li><a class="el" href="gb_8h.html#a42705001e2b9897f5167b67fb36c69dd">BANK()</a> for obtaining the bank number of the included data.</li>
</ul>
<p>Use <a class="el" href="incbin_8h.html#a51ab79f8ee37368158b1887b65ef97ec">INCBIN_EXTERN()</a> within another source file to make the variable and it's data accessible there.</p>
<hr  />
 
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- HTML footer for doxygen 1.8.14-->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
</div>
</body>
</html>
